<ng-container [formGroup]="controlContainer.control">
  <div class="d-flex align-items-center" *ngIf="!preview">
    <m-switch-checkbox formControlName="all">选择本区内所有人员</m-switch-checkbox>
  </div>
  <m-api-data-table
    [dataSource]="preview || dataSource"
    [selection]="selection"
    [markSelected]="preview || controlContainer.value.all"
  >
    <ng-container mDataTableColumn header="人员名称">
      <ng-template let-name="full_name">
        <td>{{ name }}</td>
      </ng-template>
    </ng-container>
    <ng-container mDataTableColumn header="工号">
      <ng-template let-job="job_number">
        <td>{{ job }}</td>
      </ng-template>
    </ng-container>
    <ng-container mDataTableColumn header="人员备注">
      <ng-template let-remark="remark">
        <td>{{ remark }}</td>
      </ng-template>
    </ng-container>
    <ng-container mDataTableColumn header="角色">
      <ng-template let-type="utype">
        <td><m-user-type-text [type]="type"></m-user-type-text></td>
      </ng-template>
    </ng-container>
    <ng-container mDataTableColumn header="状态">
      <ng-template let-status="status">
        <td><m-enable-status-text [status]="status"></m-enable-status-text></td>
      </ng-template>
    </ng-container>
    <ng-container mDataTableColumn header="当前终端授权">
      <ng-template let-pc_auth="pc_auth">
        <td><m-auth-type [type]="pc_auth"></m-auth-type></td>
      </ng-template>
    </ng-container>
    <ng-container mDataTableColumn header="当前终端配置">
      <ng-template let-config="pc_config">
        <td><m-auth-type [type]="config"></m-auth-type></td>
      </ng-template>
    </ng-container>
    <ng-container mDataTableColumn header="当前软件授权">
      <ng-template let-soft_auth="software_auth">
        <td><m-auth-type [type]="soft_auth"></m-auth-type></td>
      </ng-template>
    </ng-container>

    <ng-container mDataTableColumn header="登录时间">
      <ng-template let-login_at="last_login_time">
        <td>
          <span *ngIf="login_at !== '0001-01-01T00:00:00Z'">
            {{ login_at | date }}
          </span>
        </td>
      </ng-template>
    </ng-container>
  </m-api-data-table>
</ng-container>
